﻿using Basefr.Attributes;
using Basefr.Core.Auth.Entities;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Paas.Core.Sys.Entities
{
    /// <summary>
    /// 用户
    /// </summary>
    [MainTable(nameof(User))]
    public class User : UserBase<User>
    {
        /// <summary>
        /// 所属部门
        /// </summary>
        public int? OrganizationId { get; set; }
        [ForeignKey(nameof(OrganizationId))]
        public virtual Organization Organization { get; set; }

        /// <summary>
        /// 工号
        /// </summary>
        [MaxLength(100)]
        public string EmployeeNo { get; set; }

        /// <summary>
        /// 办公电话
        /// </summary>
        [MaxLength(100)]
        public string OfficePhone { get; set; }

        /// <summary>
        /// 登录次数
        /// </summary>
        public int LoginTimes { get; set; }

        /// <summary>
        /// 是否所在部门的领导
        /// </summary>
        public bool IsLeader { get; set; }

        /// <summary>
        /// 角色
        /// </summary>
        public virtual List<RoleUser> Roles { get; set; }

        /// <summary>
        /// 登录记录
        /// </summary>
        public virtual List<UserLogin> Logins { get; set; }
    }
}

